package edu.kit.csl.pisa.models;


/**
 * This estimator can be used to estimate the r and p parameters of a negative
 * binomial distribution with a predefined mean.
 */
public class MLENBEstimator extends NBEstimator {

	/**
	 * Sole constructor.
	 * 
	 * @param mu enforced mean of this distribution
	 */
	public MLENBEstimator(int mu) {
		super(mu);
	}

	/**
	 * Estimate the r and p parameters of the distribution given all
	 * training cases added so far, but enforce the distribution mean to be
	 * equal to {@link #mu}.
	 */
	@Override
	protected double estimateP(double r) {
		return 1.0 - (sumWK / (sumW*r + sumWK));
	}
}
